/**
 * reduce
 *   => 数组遍历方法, 累加
 *   => 语法:  arr.reduce( function(previous,current){
 *
 *              },0 )
 *       previous : 前一个元素，初始值是，第二个参数
 *       current: 当前元素  
 */

var arr = [10, 20, 30, 40, 50]

var sum = arr.reduce(function (previous, current) {
       return previous + current
}, 0)

console.log(sum);

